package com.vnaloha.common.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.vnaloha.common.service.ProductService;

@Controller
@RequestMapping("product")
public class ProductController {
	
	@Autowired
	private ProductService productService;
	
	@RequestMapping(value = "/compare", method = RequestMethod.GET)
	public String compareProduct() {

		return "user/compare";

	}
	@RequestMapping("/detail/{productID}")
	public String editUser(@PathVariable("productID") Integer productID,
			ModelMap modelMap) {
		
		modelMap.addAttribute("product", productService.get(productID));
		return "user/product";
	}
}
